﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<link href="__STATIC__/admin/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<body>

<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 排课管理 <span class="c-gray en">&gt;</span> 编辑排课
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>

<div class="page-container">

	<div action="" method="post" class="form form-horizontal" id="form-shops-add" enctype="multipart/form-data">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>星期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  style="width:60%;" class="input-text" id="week_day">
					{foreach name="week_arr" item="val" key="key"}
					<option value ="{$val}"  style="width:60%;"
							{if condition="$week_info['week_day'] eq  $val "} selected {/if}>
								{$val}
					</option>
					{/foreach}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>时段：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  style="width:60%;" class="input-text" id="period_id">
					{foreach name="period_list" item="val" key="key"}
					<option value ="{$val['period_id']}"  style="width:60%;"
							{if condition="$period_info['id'] eq  $val['period_id'] "} selected {/if}>
							{$val['time']}
					</option>
					{/foreach}
				</select>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input type="hidden" value="{$class_id}" id="class_id">
				<input type="hidden" value="{$week_id}" id="week_id">
				<button class="btn btn-primary radius" type="submit" id="submit">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
				<a class="btn btn-warning radius" href="{:url('class_arrange/index',array('class_id'=>$class_id))}">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
			</div>
		</div>
	</div>

</div>
{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){

        $("#submit").click(function(){

            var week_day 	    = $("#week_day").val();
            var period_id 		= $("#period_id").val();
            var class_id	    = $("#class_id").val();
            var week_id	        = $("#week_id").val();

            //异步提交
            $.ajax({
                type:"POST",
                url:"{:url('edit')}",
                data:{
                    week_day     : week_day,
                    period_id    : period_id,
                    class_id     : class_id,
                    week_id      : week_id
                },
                async:true,
                success:function (res) {
                    if(res.code === 0){
                        layer.msg(res.msg,{icon:5,time:2000});
                    }else{
                        layer.msg(res.msg,{icon:6,time:2000});
                        // 定时跳转页面
                        setTimeout(
                            function(){
                                location.href = "{:url('class_arrange/index')}"+"?class_id="+res.data;
                            },
                            2000);
                    }
                }
            });

        });

    });
</script>

</body>
</html>